def jump(nums):
    if len(nums) <= 1:  
        return 0

    def jumping(start=0, pre_stop=None, counter=0):
        # 计算当前点能到达的最远位置
        stop = start + nums[start] + 1
        # 判断从当前位置是否能够直接跳到终点
        if stop >= len(nums):
            return counter + 1
        # 搜索下一个起跳点
        new_start = start + 1 if pre_stop is None else pre_stop  # 优化
        far = new_start + 1  # 从新的起跳点能够到达的最远位置
        for i in range(new_start, stop):
            if i + nums[i] > far:
                far = i + nums[i]
                new_start = i
        # 递归
        return jumping(new_start, stop, counter + 1)

    return jumping()


if __name__ == '__main__':
    print(jump([5,9,3,2,1,0,2,3,3,1,0,0]))
